package com.zengqingfa.designpattern.structure.flyweight;

/**
 * @author zengqingfa
 * @className Client
 * @description
 * @create 2021/8/29 15:21
 */
public class Client {

    public static void main(String[] args) {
        /**
         * 内部状态变化
         * Intrinsic State = a
         * Extrinsic State = First Call
         * 内部状态变化
         * Intrinsic State = b
         * Extrinsic State = Second Call
         * Intrinsic State = a
         * Extrinsic State = Third Call
         */
        FlyWeightFactory factory = new FlyWeightFactory();
        FlyWeight fly = factory.factory(new Character('a'));
        fly.operation("First Call");

        fly = factory.factory(new Character('b'));
        fly.operation("Second Call");

        fly = factory.factory(new Character('a'));
        fly.operation("Third Call");
    }
}